package club.janna.jrpc.cluster.loadbalance.selector;

/**
 * 二的幂轮询选择器
 * @author Panbo.Guo
 */
public class PowerOfTwoRoundSelector extends AbstractRoundSelector {

    private final int mask;

    public PowerOfTwoRoundSelector(int radix) {
        this.mask = radix - 1;
    }

    @Override
    protected int next(int count) {
        return count & mask;
    }
}
